package com.cheejee.goodscenter.module.entity;

import javax.validation.constraints.NotNull;

import org.hibernate.validator.constraints.Length;

import com.cheejee.goodscenter.validated.InsertGroup;
import com.cheejee.goodscenter.validated.UpdateGroup;

import lombok.AllArgsConstructor;
import lombok.NoArgsConstructor;

@AllArgsConstructor
@NoArgsConstructor
public class Category {
	@NotNull(message = "分类id不能为空", groups = UpdateGroup.class)
    private Integer id;

	@NotNull(message = "分类父id不能为空", groups = {InsertGroup.class, UpdateGroup.class})
    private Integer parentId;

	@NotNull(message = "分类名称不能为空", groups = {InsertGroup.class, UpdateGroup.class})
	@Length(max = 200, message = "分类名称长度不能超过200字", groups = { InsertGroup.class, UpdateGroup.class })
    private String name;

    private Byte level;

    private String icon;

    private String url;

    private String describe;

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public Integer getParentId() {
        return parentId;
    }

    public void setParentId(Integer parentId) {
        this.parentId = parentId;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name == null ? null : name.trim();
    }

    public Byte getLevel() {
        return level;
    }

    public void setLevel(Byte level) {
        this.level = level;
    }

    public String getIcon() {
        return icon;
    }

    public void setIcon(String icon) {
        this.icon = icon == null ? null : icon.trim();
    }

    public String getUrl() {
        return url;
    }

    public void setUrl(String url) {
        this.url = url == null ? null : url.trim();
    }

    public String getDescribe() {
        return describe;
    }

    public void setDescribe(String describe) {
        this.describe = describe == null ? null : describe.trim();
    }

    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append(getClass().getSimpleName());
        sb.append(" [");
        sb.append("Hash = ").append(hashCode());
        sb.append(", id=").append(id);
        sb.append(", parentId=").append(parentId);
        sb.append(", name=").append(name);
        sb.append(", level=").append(level);
        sb.append(", icon=").append(icon);
        sb.append(", url=").append(url);
        sb.append(", describe=").append(describe);
        sb.append("]");
        return sb.toString();
    }
}